package com.zenithmind.exam.pojo.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.zenithmind.common.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 考试记录实体类
 * 
 * @author ZenithMind
 * @since 2024-07-01
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Schema(name = "考试记录实体", description = "考试记录信息")
@TableName("exam_record")
public class ExamRecord extends BaseEntity {

    /**
     * 考试ID
     */
    @NotBlank(message = "考试ID不能为空")
    @Schema(description = "考试ID")
    private String examId;

    /**
     * 考试标题
     */
    @NotBlank(message = "考试标题不能为空")
    @Size(max = 200, message = "考试标题长度不能超过200个字符")
    @Schema(description = "考试标题")
    private String examTitle;

    /**
     * 用户ID
     */
    @NotBlank(message = "用户ID不能为空")
    @Schema(description = "用户ID")
    private String userId;

    /**
     * 用户姓名
     */
    @NotBlank(message = "用户姓名不能为空")
    @Size(max = 50, message = "用户姓名长度不能超过50个字符")
    @Schema(description = "用户姓名")
    private String userName;

    /**
     * 状态（0:未开始, 1:进行中, 2:已提交, 3:已评分, 4:已超时）
     */
    @Schema(description = "状态（0:未开始, 1:进行中, 2:已提交, 3:已评分, 4:已超时）")
    private Integer status;

    /**
     * 开始时间
     */
    @Schema(description = "开始时间")
    private LocalDateTime startTime;

    /**
     * 提交时间
     */
    @Schema(description = "提交时间")
    private LocalDateTime submitTime;

    /**
     * 用时（秒）
     */
    @Schema(description = "用时（秒）")
    private Integer durationSeconds;

    /**
     * 总分
     */
    @Schema(description = "总分")
    private Integer totalScore;

    /**
     * 用户得分
     */
    @Schema(description = "用户得分")
    private BigDecimal userScore;

    /**
     * 得分率
     */
    @Schema(description = "得分率")
    private BigDecimal scoreRate;

    /**
     * 正确题目数
     */
    @Schema(description = "正确题目数")
    private Integer correctCount;

    /**
     * 错误题目数
     */
    @Schema(description = "错误题目数")
    private Integer wrongCount;

    /**
     * 未答题目数
     */
    @Schema(description = "未答题目数")
    private Integer unansweredCount;

    /**
     * 是否及格（0:不及格, 1:及格）
     */
    @Schema(description = "是否及格（0:不及格, 1:及格）")
    private Integer isPassed;

    /**
     * 答题详情（JSON格式）
     */
    @Schema(description = "答题详情（JSON格式）")
    private String answerDetails;

    /**
     * IP地址
     */
    @Schema(description = "IP地址")
    private String ipAddress;

    /**
     * 用户代理
     */
    @Schema(description = "用户代理")
    private String userAgent;
}
